﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/CompanyConsole.Master" Inherits="System.Web.Mvc.ViewPage<NewsMGModels>" %>

<asp:Content ID="Content2" ContentPlaceHolderID="HeadHolder" runat="server">
<script type="text/javascript" src="/Scripts/xheditor/xheditor-1.1.7-zh-cn.min.js"></script>
<script type="text/javascript" src="/Scripts/xheditor/ConfigXheditor.js"></script>
<script type="text/javascript">
    $(function () {
        myAccordion.showThisHideOpen(contents[1]);
    });
    function DeleteItem(sender, id) {
        if (confirm('您确定删除此条动态吗？一旦删除不能回复')) {
            $.get('/DeleteNewsItemMG',
            { 'newsid': id },
            function (result) {
                if (result == '1') {
                    alert('删除成功');
                    $(sender).parent().parent().remove();
                }
                else {
                    alert('操作失败，请稍候再试');
                }
            }, 'text');
        }
    }
    function Cancel() {
        $('#btnreset').trigger('click');
        $('#editbox').hide();
        $('#newsbox').show();
    }
    function Edit(id) {
        $('#newsbox').hide();
        $('#editbox').show();
    }
    function Add(sender) {
        $('#newsbox').hide();
        $('#btnreset').trigger('click');
        $('#editbox').show();
        $('#tarContent').xheditor(editorConfig);
    }
    <%if(!Model.IsValid)
    { %>
        $(function(){
            $('#newsbox').hide();
            $('#btnreset').trigger('click');
            $('#editbox').show();
                $('#tarContent').xheditor(editorConfig);
        });
    <%} %>
</script>
<%=Empires.PL.PageBuilder.ControlBuilder.BuildMianInfoDisplaySegment(Model).Script %>
</asp:Content>

<asp:Content ID="Content1" ContentPlaceHolderID="BodyHolder" runat="server">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
        <tr>
            <td width="17" height="29" valign="top" background="/Content/images/Console/mail_leftbg.gif">
                <img src="/Content/images/Console/left-top-right.gif" width="17" height="29" />
            </td>
            <td width="935" height="29" valign="top" background="/Content/images/Console/content-bg.gif">
                <table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="left_topbg"
                    id="table2">
                    <tr>
                        <td height="31">
                            <div class="titlebt">
                                企业动态</div>
                        </td>
                    </tr>
                </table>
            </td>
            <td width="16" valign="top" background="/Content/images/Console/mail_rightbg.gif">
                <img src="/Content/images/Console/nav-right-bg.gif" width="16" height="29" />
            </td>
        </tr>
        <tr>
            <td height="71" valign="middle" background="/Content/images/Console/mail_leftbg.gif">
                &nbsp;
            </td>
            <td valign="top" bgcolor="#F7F8F9">
                <table width="100%" height="138" border="0" cellpadding="0" cellspacing="0">
                    <tr>
                        <td height="13" valign="top">
                            &nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td valign="top">
                            <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td class="left_txt" style="border-bottom:1px solid #aaa;">
                                        当前位置：企业动态管理
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <table style="margin-top:10px;" width="100%" height="55" border="0" cellpadding="0" cellspacing="0">
                                            <tr>
                                                <td width="10%" height="55" valign="middle">
                                                    <img src="/Content/images/Console/title.gif" width="54" height="55">
                                                </td>
                                                <td width="90%" valign="top">
                                                    <span class="left_txt2">在这里，您可以编辑您企业的最新动态<span
                                                        class="left_txt2">！</span><br/>
                                                    <span class="left_txt2">通常</span><span class="left_txt3">您应该在这里发布一些关于您企业的重大事件或某些新产品，新业务的开通</span><span
                                                        class="left_txt2">等<span class="left_txt2">。
                                                        </span>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <table style="margin-top:10px;" width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="nowtable">
                                            <tr>
                                                <td class="left_bt2" style="width:35%;">
                                                    &nbsp;&nbsp;&nbsp;&nbsp;企业动态管理
                                                    
                                                </td>
                                                <td>
                                                 <td>
                                                    <%=Model.SuccessMessage %>
                                                    <%:Html.ValidationSummary(true,"") %>
                                                </td>
                                                </td>
                                                <td align="right" style="width:35%;">
                                                    <a href="javascript:;" onclick="Add(this)" style="margin-right:30px;">
                                                    <img name="add" src="/Content/images/edit_add.png" style="border:none; margin-top:5px;"/>
                                                    <label for="add" style="cursor:pointer;">添加动态</label>
                                                    </a>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                                <tr>
                                    <td>  
                                    <div id="newsbox">
                                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                        <tr height="30"  bgcolor="#f2f2f2">
                                            <td width="10%" align="center">&nbsp;</td>
                                            <td width="12%" align="center">发布时间</td>
                                            <td width="23%" align="center">标题</td>
                                            <td width="5%" align="center">点击量</td>
                                            <td width="10%" align="center">作者</td>
                                            <td width="20%" align="center">属于主题</td>
                                            <td width="25%" align="center">操作</td>
                                          <%--  <td width="20%" height="30" align="right" bgcolor="#f2f2f2" class="left_txt2">
                                                主题图片：
                                            </td>
                                            <td width="80%" colspan="3" height="30" bgcolor="#f2f2f2" class="left_txt" style="">
                                              <input type="file" name="AboutUsImg" style="width:284px;" />
                                              <span class="left_txt">一张最能代表您公司的主题图片(请选择jpg、png格式图片)</span>
                                            </td>--%>
                                        </tr>
                                        <%var list = ViewData["Data"] as List<DefaultDataPack>;
                                          int i = 1;
                                          foreach (var item in list)
                                          { %>
                                        <tr height="30">
                                            <td align="center"><%:i++ %></td>
                                            <td align="center"><%:item.DATE%></td>
                                            <td align="center"><%:item.TITLE %></td>
                                            <td align="center"><%:item.HIT %></td>
                                            <td align="center"><%:item.AUTHOR %></td>
                                            <td align="center">
                                            <%if (!String.IsNullOrEmpty(item.TYPE))
                                              { %>
                                                <select name="type">
                                                    <option value="0">主分类</option>
                                                </select>
                                                <%}
                                                  if(!String.IsNullOrEmpty(item.SUBJECT))
                                                  { %> ------
                                                <select name="subject">
                                                    <option value="0">主题分类</option>
                                                </select>
                                                <%}
                                              if (String.IsNullOrEmpty(item.TYPE) && String.IsNullOrEmpty(item.SUBJECT))
                                              { %>
                                              企业动态
                                            <%} %>
                                            </td>
                                            <td align="center">
                                                <a target="_blank" href="/NewsDetail?nid=<%:item.ID %>">查看</a>
                                                <a href="javascript:;" onclick="Edit('<%:item.ID %>')">编辑</a>
                                                <a href="javascript:;" onclick="DeleteItem(this,'<%:item.ID %>')">删除</a>
                                            </td>
                                        </tr>
                                        <%} %>
                                        <tr height="30">
                                            <td colspan="4" align="left" style="padding-left:30px;">
                                                <div style="float:left;">
                                                    <a href="?page=0"><img style="border:none;" src="/Content/images/pagination_first.gif" /></a>
                                                    <a href="?page=<%:list[0].PREVIOUSPAGE %>"><img style="border:none;" src="/Content/images/pagination_prev.gif" /></a>
                                                </div>
                                                <div style="padding-top:1px; float:left;">当前第<%:list[0].CURRENTPAGE %>/<%:list[0].PAGECOUNT %>页</div> 
                                                <div>
                                                     <a href="?page=<%:list[0].NEXTPAGE %>"><img style="border:none;" src="/Content/images/pagination_next.gif" /></a>
                                                    <a href="?page=<%:list[0].LASTPAGE %>"><img style="border:none;" src="/Content/images/pagination_last.gif" /></a>

                                                </div>
                                            </td>
                                            <td height="17" colspan="3" align="center">
                                                &nbsp;
                                            </td>
                                        </tr>
                                    </table>
                                    </div>
                                    <div id="editbox" style="display:none;">
                                        <form method="post" action="/NewsMG">
                                            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                                <tr height="30">
                                                    <td width="5%">&nbsp;</td>
                                                    <td width="10%">标题：</td>
                                                    <td width="20%"><input type="text" name="Title" style="width:300px;" /></td>
                                                    <td><%if (!Model.IsValid)
                                                          { %>
                                                          <%:Html.ValidationMessageFor(c=>c.Title) %>
                                                        <%}%></td>
                                                </tr>
                                                <tr height="30">
                                                    <td>&nbsp;</td>
                                                    <td>资讯来源：</td>
                                                    <td><input type="text" name="From" style="width:300px;" /></td>
                                                    <%if (!Model.IsValid)
                                                      {%>
                                                      <td style="color:Red;"><%:Html.ValidationMessageFor(c => c.From)%></td>
                                                    <%}
                                                      else
                                                      { %>
                                                    <td style="color:#999;">(选填)如果您的资讯来源去其他网站，企盟建议您注明来源</td>
                                                    <%} %>
                                                </tr>
                                                <%=Empires.PL.PageBuilder.ControlBuilder.BuildMianInfoDisplaySegment(Model).Html %>
                                                <tr height="30">
                                                    <td>&nbsp;</td>
                                                    <td>编辑(作者)：</td>
                                                    <td><input type="text" name="Author" style="width:300px;" /></td>
                                                    <%if (!Model.IsValid)
                                                      {%>
                                                      <td style="color:Red;"><%:Html.ValidationMessageFor(c => c.Author)%></td>
                                                    <%}
                                                      else
                                                      {%>
                                                      <td>&nbsp;</td>
                                                      <%} %>
                                                </tr>
                                                <tr>
                                                    <td>&nbsp;</td>
                                                    <td>内容：</td>
                                                    <td colspan="2"><textarea name="Content" id="tarContent" style="height:300px; width:600px;"></textarea></td>
                                                </tr>
                                                <%if(!Model.IsValid)
                                                  { %>
                                                  <tr>
                                                    <td></td>
                                                    <td colspan="3"><%:Html.ValidationMessageFor(c=>c.Content) %></td>
                                                  </tr>
                                                  <%} %>
                                                <tr height="30">
                                                    <td colspan="2"></td>
                                                    <td colspan="2">
                                                        <input type="submit" value="提交" />
                                                        <input type="reset" id="btnreset" value="重填" />
                                                        <input type="button" value="取消" onclick="Cancel()" />
                                                    </td>
                                                </tr>
                                            </table>
                                        </form>
                                    </div>
                                    </td>
                                </tr>
                            </table>
                           
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td valign="middle" background="/Content/images/Console/mail_leftbg.gif">
                <img src="/Content/images/Console/buttom_left2.gif" width="17" height="17" />
            </td>
            <td height="17" valign="top" background="/Content/images/Console/buttom_bgs.gif">
                <img src="/Content/images/Console/buttom_bgs.gif" width="17" height="17" />
            </td>
            <td background="/Content/images/Console/mail_rightbg.gif">
                <img src="/Content/images/Console/buttom_right2.gif" width="16" height="17" />
            </td>
        </tr>
    </table>
</asp:Content>
